package com.telchina.common.controller;

import com.telchina.common.core.controller.BaseController;
import com.telchina.common.core.domain.AjaxResult;
import com.telchina.common.service.IBaseFlowService;
import com.telchina.workorder.third.service.BpmProcessInstanceThirdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 分类字典Controller
 *
 * @author konghao
 * @date 2023-02-21
 */
@RestController
@RequestMapping("/common/baseflow")
public class BaseFlowController extends BaseController {
    @Autowired
    private IBaseFlowService baseFlowService;
    @Autowired
    private BpmProcessInstanceThirdService processInstanceThirdService;

    /**
     * 判断流程是否可以处理
     */
    @GetMapping("/checkUserIdDoTask/{taskId}")
    public AjaxResult checkUserIdDoTask(@PathVariable String taskId) {
        return AjaxResult.success(baseFlowService.checkUserIdDoTask(taskId));
    }

    /**
     * 获取图片
     */
    @GetMapping("/generateHighlightDiagram/{processInstanceId}")
    public AjaxResult generateHighlightDiagram(@PathVariable String processInstanceId) {
        return processInstanceThirdService.generateHighlightDiagram(processInstanceId);
    }

    /**
     * 获取流程处理过程中的按钮
     */
    @GetMapping("/getOptButton/{taskDefinitionkey}")
    public AjaxResult getOptButton(@PathVariable String taskDefinitionkey) {
        return baseFlowService.getOptButton(taskDefinitionkey);
    }

}
